package com.sport.facilities.booking.system.httptask;

import java.util.List;

import android.content.Context;
import android.util.Log;

import com.sport.facilities.booking.system.htmlchecker.CancelBookingResultChecker;
import com.sport.facilities.booking.system.htmlchecker.TransferBookingFormResultChecker;
import com.sport.facilities.booking.system.htmlchecker.TransferBookingResultChecker;
import com.sport.facilities.booking.system.model.Booking;
import com.sport.facilities.booking.system.model.BookingRequestModel;

public class TransferBookingFormResultTask extends BasicTask {	
	
	private final String TAG = "TransferBookingResultTask";

	public TransferBookingFormResultTask(Context ctx, OnTaskCompleted completeAction) {
		super(ctx);
		this.listener = completeAction;
	}

	public void fnTransferBookForm(BookingRequestModel bkmodel) {
		try {
			super.onPreExecute();
			super.execute(PATH_POST_TRANSFER_FORM,bkmodel);
		} catch (Exception e) {
			this.listener.onTaskFailed(e.getMessage());
		}
	}

	@Override
	protected void onPostExecute(String result) {
		super.onPostExecute(result);
		TransferBookingFormResultChecker tbfrChecker = new TransferBookingFormResultChecker();
		boolean isTransferSuccess = tbfrChecker.getTransferBookingFormResultfromHtml(result);
		if (isTransferSuccess) {
			this.listener.onTaskCompleted(null);
		} else {
			this.listener.onTaskFailed("Error in transfer booking...");
		}
	}
}
